#!/bin/sh

#ifconfig eth0 192.168.0.2 netmask 255.255.0.0
#route add default gw 192.168.0.1
#mount -t nfs -o nolock 192.168.0.1:/nfs/rootfs /mnt

#/sbin/modprobe ide-cd
dd if=/Test.fat of=/dev/rd/0
mount -t vfat /dev/rd/0 /mnt/rd
swapon /mnt/rd/swap.img

/sbin/modprobe sata_mars&

/sbin/modprobe mmc_core
/sbin/modprobe mmc_block
/sbin/modprobe rtk_sd&

#rm -f /usr/local/etc/dvdplayer/VenusSetup.dat 
mkdir /var/run	#hcy added 1
ln -s /dev/cdroms/cdrom0 /dev/cdrom0
ln -s /dev/cdrom0 /dev/dvd
ln -s /mnt/dvdvr /dev/dvdvr

# This variable tells DvdPlayer the firmware URL for internet updating
export LIVEUPDATE_URL=
export use_ipad_useragent=yes
DEFAULT_AP_DIR=/usr/local/bin
#Begin system font change routine
fontfile="/usr/local/etc/.fontype"
dirfont="/usr/local/bin/Resource/font"
if [ -f $fontfile ]; then
fontype=`cat $fontfile`
if [ $fontfile != "msyh.ttf" ]; then
mount -o bind $dirfont/$fontype $dirfont/msyh.ttf
fi
mount -o bind $dirfont/$fontype $dirfont/uEGB.mbf
fi
#End system font change routine
if [ -f $DEFAULT_AP_DIR/DvdPlayer ] && [ -x $DEFAULT_AP_DIR/DvdPlayer ]; then
	cd $DEFAULT_AP_DIR; touch /tmp/ir
	if [ -f $DEFAULT_AP_DIR/RootApp ] && [ -x $DEFAULT_AP_DIR/RootApp ]; then
		echo Running dvdplayer with RootApp
		tail -f /tmp/ir | ./RootApp DvdPlayer&
	else
		echo Running dvdplayer
		tail -f /tmp/ir | ./DvdPlayer&
	fi
else
	echo 1 > /sys/realtek_boards/reclaim_dvr
	/etc/dvdplayer/script/run_tail
fi
echo 2 /tmp/hdd/volumes/HDD1/ > /sys/realtek_boards/misc_operations
/usr/bin/busybox httpd -f -c /usr/local/etc/httpd.conf &
#/opt/etc/init.d/S80lighttpd start
sleep 30 && swapon `fdisk -l | grep swap | cut -d" " -f 1`
sed -i '1 i\nameserver 8.8.8.8' /usr/local/etc/resolv.conf
rm -f /usr/local/etc/rtorrent/session/rtorrent.lock
for i in /usr/local/etc/init.d/S??* ;do
	$i &
done
/usr/local/etc/mount_rw.sh &
/usr/local/etc/startup_update_check.sh &
